import { HOST } from './constant'
export function post(url, prams= {}) {
    return new Promise((resolve, reject) => {
        wx.request({
            method: "POST",
            url: `${HOST}${url}`,
            data: prams,
            header: { 'content-type': 'application/json' },
            success: (res) => {
                const { data } = res
                resolve(data)
            }
        })
    })
}

export function get(url) {
    return new Promise((resolve, reject) => {
        wx.request({
            method: "GET",
            url: `${HOST}${url}`,
            data: {},
            header: { 'content-type': 'application/json' },
            success: (res) => {
                const { data } = res
                resolve(data)
            }
        })
    })
}